package com.ruoyi.qsng.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.uuid.SnowFlakeUtil;
import com.ruoyi.qsng.domain.KWriteOff;
import com.ruoyi.qsng.mapper.KWriteOffMapper;
import com.ruoyi.qsng.service.IKWriteOffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 商品-我的核销Service业务层处理
 *
 * @author kanglou
 * @date 2023-06-07
 */
@Service
public class KWriteOffServiceImpl implements IKWriteOffService {
    @Autowired
    private KWriteOffMapper kWriteOffMapper;

    /**
     * 查询商品-我的核销
     *
     * @param id 商品-我的核销主键
     * @return 商品-我的核销
     */
    @Override
    public KWriteOff selectKWriteOffById(String id) {
        return kWriteOffMapper.selectKWriteOffById(id);
    }

    /**
     * 查询商品-我的核销列表
     *
     * @param kWriteOff 商品-我的核销
     * @return 商品-我的核销
     */
    @Override
    public List<KWriteOff> selectKWriteOffList(KWriteOff kWriteOff) {
        return kWriteOffMapper.selectKWriteOffList(kWriteOff);
    }

    /**
     * 查询商品-我的核销列表
     *
     * @param kWriteOff 商品-我的核销
     * @return 商品-我的核销集合
     */
    @Override
    public List<KWriteOff> selectKWriteOffDataList(KWriteOff kWriteOff) {
        return kWriteOffMapper.selectKWriteOffDataList(kWriteOff);
    }

    /**
     * 新增商品-我的核销
     *
     * @param kWriteOff 商品-我的核销
     * @return 结果
     */
    @Override
    public int insertKWriteOff(KWriteOff kWriteOff) {
        kWriteOff.setId(SnowFlakeUtil.getNextId());
        kWriteOff.setCreateTime(DateUtils.getNowDate());
        return kWriteOffMapper.insertKWriteOff(kWriteOff);
    }

    /**
     * 修改商品-我的核销
     *
     * @param kWriteOff 商品-我的核销
     * @return 结果
     */
    @Override
    public int updateKWriteOff(KWriteOff kWriteOff) {
        kWriteOff.setUpdateTime(DateUtils.getNowDate());
        return kWriteOffMapper.updateKWriteOff(kWriteOff);
    }

    /**
     * 批量删除商品-我的核销
     *
     * @param ids 需要删除的商品-我的核销主键
     * @return 结果
     */
    @Override
    public int deleteKWriteOffByIds(String[] ids) {
        return kWriteOffMapper.deleteKWriteOffByIds(ids);
    }

    /**
     * 删除商品-我的核销信息
     *
     * @param id 商品-我的核销主键
     * @return 结果
     */
    @Override
    public int deleteKWriteOffById(String id) {
        return kWriteOffMapper.deleteKWriteOffById(id);
    }
}
